#include<bits/stdc++.h>

using namespace std;
int a[101][101], n, m, from, to, dis[101], book[101];
const int INF = 9999;

void Dijkstra(int s) {
    fill(book + 1, book + n + 1, false);
    fill(dis + 1, dis + n + 1, INF);
    dis[s]=0;
    for (int i = 1; i <= n; i++) {
        book[i] = 0;
        dis[i] = a[s][i];
    }
    book[s] = 1;///第一个点加入了确定最短路径的集合中
    for (int i = 1; i < n; i++) {
        int u = 1, MIN = INF;
        for (int j = 1; j <= n; j++) {
            if (book[j] == 0 && dis[j] < MIN) {/// 找dis数组中权值最小的点
                u = j;///待加入的点
                MIN = dis[j];
            }
        }
        book[u] = 1;
        for (int j = 1; j <= n; j++) {
            if (book[j] == 0 && a[u][j] < INF && dis[j] > dis[u] + a[u][j]) {
                dis[j] = dis[u] + a[u][j];
            }
        }
    }

}

int main() {
    while (cin >> n >> m >> from >> to) {
        for (int i = 1; i <= n; i++)
            for (int j = 1; j <= n; j++) {
                a[i][j] = INF;
            }

        for (int i = 1; i <= m; i++) {
            int x, y;
            cin >> x >> y;
            a[x][y] = 1;
            a[y][x] = 1;
        }
        Dijkstra(from);
        if (dis[to] < INF)cout << dis[to] << endl;
        else cout << "Cannot reach" << endl;

    }
    return 0;
}